package com.ideafactory.client.ybservice.xmpphandler;

import com.ideafactory.client.afinal.NetConstants;
import com.ideafactory.client.utils.CommonUtils;
import com.ideafactory.client.utils.HeartBeatClient;
import com.ideafactory.client.utils.HintViewUtils;
import com.ideafactory.client.utils.SdCardUtils;
import com.ideafactory.client.utils.VersionUpdateConstants;
import com.ideafactory.client.utils.netutils.MyCallBack;
import com.ideafactory.client.utils.netutils.NetUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by LiuShao on 2016/5/11.
 */
public class ResourceUpdate {

    private static String UPLOAD_DISK_URL = NetConstants.RESOURSE_BASE_URL + "/device/service/uploadDisk.html";

    private static String UPLOAD_APP_VERSION_URL = NetConstants.RESOURSE_BASE_URL + "/device/service/uploadAppVersionNew.html";
    /**
     * 版本检测
     **/
    public static String VERSION_URL = NetConstants.RESOURSE_BASE_URL + "/device/service/getversion.html";


    private static String WEB_BASE_URL = NetConstants.RESOURSE_BASE_URL;
    public static String CACHE_BASE_PATH = "/mnt/sdcard/hsd/";


    public static String PROPERTY_CACHE_PATH = CACHE_BASE_PATH + "property/";// 参数缓存存储目录
    public static String SCREEN_CACHE_PATH = CACHE_BASE_PATH + "screen/";// 参数缓存存储目录

    /**
     * SER_NUMBER
     **/
    public static String SER_NUMBER = WEB_BASE_URL + "device/status/getHasNumber.html";
    /**
     * 截图上传
     **/
    public static String SCREEN_UPLOAD_URL = WEB_BASE_URL + "/device/service/uploadScreenImg.html";

    public static void uploadAppVersion() {
        String versionName = CommonUtils.getVersionName();
        HintViewUtils.showMyToast("版本:" + versionName, -1);
        Map paramMap = new HashMap<String, String>();
        paramMap.put("deviceNo", HeartBeatClient.getDeviceNo());
        paramMap.put("version", versionName);
        paramMap.put("type", VersionUpdateConstants.CURRENT_VERSION + "");
        NetUtils.Post(UPLOAD_APP_VERSION_URL, paramMap, new MyCallBack<String>() {});
    }

    /**
     * 上传磁盘数据
     */
    public static void uploadDiskInfo() {
        String diskInfo = SdCardUtils.getSDDiskCon();
        String ss = "磁盘:" + diskInfo;
        HintViewUtils.showMyToast(ss, -1);
        Map paramMap = new HashMap<String, String>();
        paramMap.put("deviceNo", HeartBeatClient.getDeviceNo());
        paramMap.put("diskInfo", diskInfo);
        NetUtils.Post(UPLOAD_DISK_URL, paramMap, new MyCallBack<String>() {});
    }

    public static void deleteOtherFile() {

    }


}
